package changzhuo

import (
"net/url"
"strings"
"NiKSMS/Tools"
"github.com/axgle/mahonia"
"net/http"
"fmt"
"io/ioutil"
)


func SendSMS() {

	v := url.Values{}
	v.Add("action", "send")
	v.Add("userid", "")
	v.Add("account", "scs01050")
	v.Add("password", strings.ToUpper(Tools.MD5("669703")))
	v.Add("mobile", "18001901021")
	decoder := mahonia.NewEncoder("utf8")
	v.Add("content", decoder.ConvertString("您的验证码是123456【拟酷游戏】"))

	var client = &http.Client{}

	res, err := client.PostForm("http://sms.chanzor.com:8001/sms.aspx", v)

	if err != nil {
		fmt.Println(err)
	}

	defer res.Body.Close()

	fmt.Println(res.StatusCode)
	if res.StatusCode == 200 {
		body , _ := ioutil.ReadAll(res.Body)
		fmt.Println(string((body)))
	}

}

func init(){
	SendSMS()
}